package com.jbm.jsm.iface;

import com.jbm.core.iface.IAcross;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

/**
 * Created by Administrator on 2017/9/26.
 */
@Entity
@Table(name = "orders", schema = "", catalog = "jsm")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true, optimisticLock = OptimisticLockType.VERSION )

public class OrderEntity extends IAcross
{
    @Transient
    public int user_id;
    private int orderId;
    private Integer tId;
    private Integer saId;
    private String ip;
    private Integer valid;
    private Integer status;
    private String orderCode;
    private Timestamp confirmDate;
    private Integer createId;
    private Timestamp createDate;
    private Integer version;
    private Timestamp cancelDate;
    private Timestamp overDate;
    private Timestamp alloverDate;
    private Timestamp arbitrateDate;
    private BigDecimal deposit;//预计佣金
    private BigDecimal userpay;//垫付
    private Integer mibao; //商家预计米宝
private SmallAccountEntity smallAccountEntity;
    private UserEntity  userEntity;
    private Integer isDeposit;
    private Integer isUserpay;
    private  TaskEntity taskEntity;
    private Integer realMibao;//商家实际米宝
    private BigDecimal realDeposit;//实际佣金
    private Integer ssMibao; //刷手预计花费米宝
    private Integer ssRealmibao; //刷手实际花费米宝
    private String orderCodeOuter; //外部订单号
    private Integer lastStatus;//上一状态，用于仲裁
    private String registOvers;
    private List<TaskRequireEntity> requireList; //交单条件
    public OrderEntity()
    {
        super();
    }

    public OrderEntity(IAcross ia)
    {
        super(ia);
    }

    @Id
    @Column(name = "order_id")
    @GeneratedValue
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    @Basic
    @Column(name = "t_id")
    public Integer gettId() {
        return tId;
    }

    public void settId(Integer tId) {
        this.tId = tId;
    }

    @Basic
    @Column(name = "sa_Id")
    public Integer getSaId() {
        return saId;
    }

    public void setSaId(Integer saId) {
        this.saId = saId;
    }

    @Basic
    @Column(name = "ip")
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Basic
    @Column(name = "valid")
    public Integer getValid() {
        return valid;
    }

    public void setValid(Integer valid) {
        this.valid = valid;
    }

    @Basic
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "order_code")
    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    @Basic
    @Column(name = "confirm_date")
    public Timestamp getConfirmDate() {
        return confirmDate;
    }

    public void setConfirmDate(Timestamp confirmDate) {
        this.confirmDate = confirmDate;
    }

    @Basic
    @Column(name = "create_id")
    public Integer getCreateId() {
        return createId;
    }

    public void setCreateId(Integer createId) {
        this.createId = createId;
    }

    @Basic
    @Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Version
    @Column(name = "version")
    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    @Basic
    @Column(name = "over_date")
    public Timestamp getOverDate() {
        return overDate;
    }

    public void setOverDate(Timestamp overDate) {
        this.overDate = overDate;
    }

    @Basic
    @Column(name = "allover_date")
    public Timestamp getAlloverDate() {
        return alloverDate;
    }

    public void setAlloverDate(Timestamp alloverDate) {
        this.alloverDate = alloverDate;
    }

    @Basic
    @Column(name = "arbitrate_date")
    public Timestamp getArbitrateDate() {
        return arbitrateDate;
    }

    public void setArbitrateDate(Timestamp arbitrateDate) {
        this.arbitrateDate = arbitrateDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        OrderEntity that = (OrderEntity) o;

        if (orderId != that.orderId) return false;
        if (confirmDate != null ? !confirmDate.equals(that.confirmDate) : that.confirmDate != null) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (createId != null ? !createId.equals(that.createId) : that.createId != null) return false;
        if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
        if (orderCode != null ? !orderCode.equals(that.orderCode) : that.orderCode != null) return false;
        if (saId != null ? !saId.equals(that.saId) : that.saId != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (tId != null ? !tId.equals(that.tId) : that.tId != null) return false;
        if (valid != null ? !valid.equals(that.valid) : that.valid != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = orderId;
        result = 31 * result + (tId != null ? tId.hashCode() : 0);
        result = 31 * result + (saId != null ? saId.hashCode() : 0);
        result = 31 * result + (ip != null ? ip.hashCode() : 0);
        result = 31 * result + (valid != null ? valid.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (orderCode != null ? orderCode.hashCode() : 0);
        result = 31 * result + (confirmDate != null ? confirmDate.hashCode() : 0);
        result = 31 * result + (createId != null ? createId.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        return result;
    }

    @Transient
    public SmallAccountEntity getSmallAccountEntity() {
        return smallAccountEntity;
    }

    public void setSmallAccountEntity(SmallAccountEntity smallAccountEntity) {
        this.smallAccountEntity = smallAccountEntity;
    }

    @Transient
    public UserEntity getUserEntity() {
        return userEntity;
    }

    public void setUserEntity(UserEntity userEntity) {
        this.userEntity = userEntity;
    }

    @Basic
    @Column(name = "cancel_date")
    public Timestamp getCancelDate() {
        return cancelDate;
    }

    public void setCancelDate(Timestamp cancelDate) {
        this.cancelDate = cancelDate;
    }

    @Basic
    @Column(name = "deposit", columnDefinition="BigDecimal default 0")
    public BigDecimal getDeposit() {
        return deposit;
    }

    public void setDeposit(BigDecimal deposit) {
        this.deposit = deposit;
    }

    @Basic
    @Column(name = "userpay", columnDefinition="BigDecimal default 0")
    public BigDecimal getUserpay() {
        return userpay;
    }

    public void setUserpay(BigDecimal userpay) {
        this.userpay = userpay;
    }

    @Basic
    @Column(name = "mibao", columnDefinition="int default 0")
    public Integer getMibao() {
        return mibao;
    }

    public void setMibao(Integer mibao) {
        this.mibao = mibao;
    }

    @Basic
    @Column(name = "is_deposit")
    public Integer getIsDeposit() {
        return isDeposit;
    }

    public void setIsDeposit(Integer isDeposit) {
        this.isDeposit = isDeposit;
    }

    @Basic
    @Column(name = "is_userpay")
    public Integer getIsUserpay() {
        return isUserpay;
    }

    public void setIsUserpay(Integer isUserpay) {
        this.isUserpay = isUserpay;
    }

    @Transient
    public TaskEntity getTaskEntity() {
        return taskEntity;
    }

    public void setTaskEntity(TaskEntity taskEntity) {
        this.taskEntity = taskEntity;
    }

    @Basic
    @Column(name = "real_mibao")
    public Integer getRealMibao() {
        return realMibao;
    }

    public void setRealMibao(Integer realMibao) {
        this.realMibao = realMibao;
    }

    @Basic
    @Column(name = "real_deposit")
    public BigDecimal getRealDeposit() {
        return realDeposit;
    }

    public void setRealDeposit(BigDecimal realDeposit) {
        this.realDeposit = realDeposit;
    }

    @Basic
    @Column(name = "ss_mibao")
    public Integer getSsMibao() {
        return ssMibao;
    }

    public void setSsMibao(Integer ssMibao) {
        this.ssMibao = ssMibao;
    }

    @Basic
    @Column(name = "ss_realmibao")
    public Integer getSsRealmibao() {
        return ssRealmibao;
    }

    public void setSsRealmibao(Integer ssRealmibao) {
        this.ssRealmibao = ssRealmibao;
    }

    @Basic
    @Column(name = "order_code_outer")
    public String getOrderCodeOuter() {
        return orderCodeOuter;
    }

    public void setOrderCodeOuter(String orderCodeOuter) {
        this.orderCodeOuter = orderCodeOuter;
    }

    @Basic
    @Column(name = "lastStatus")
    public Integer getLastStatus() {
        return lastStatus;
    }

    public void setLastStatus(Integer lastStatus) {
        this.lastStatus = lastStatus;
    }

    @Basic
    @Column(name = "registOvers")
    public String getRegistOvers() {
        return registOvers;
    }

    public void setRegistOvers(String registOvers) {
        this.registOvers = registOvers;
    }

    @Transient
    public List<TaskRequireEntity> getRequireList() {
        return requireList;
    }

    public void setRequireList(List<TaskRequireEntity> requireList) {
        this.requireList = requireList;
    }
}
